package com.zmn.plat.dubbo.impl.part;

import java.util.List;

import org.apache.dubbo.config.annotation.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.common.utils.reflect.BeanMapper;
import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
import com.zmn.plat.common.dto.part.PartSkuUnitDRO;
import com.zmn.plat.dubbo.interfaces.part.PartSkuUnitListRemoteService;
import com.zmn.plat.dubbo.utils.DubboConsts;
import com.zmn.plat.model.entity.part.PartSkuUnit;
import com.zmn.plat.services.interfaces.part.PartSkuUnitService;

/**
 * 查询配件单位换算
 *
 * @author xiangjunming
 * @since 2019/05/07 10:28:38
 */
@Service(loadbalance = "roundrobin", timeout = 5000, retries = -1, version = DubboConsts.INTERFACE_VERSION)
public class PartSkuUnitListRemoteServiceImpl implements PartSkuUnitListRemoteService {

    private Logger logger = LoggerFactory.getLogger(PartSkuUnitListRemoteServiceImpl.class);

    @Autowired
    private PartSkuUnitService service;

    private static final String TAG = "配件拆分关系 dubbo 接口";

    @Override
    @ReadOnlyConnection
    public ResponseDTO<List<PartSkuUnitDRO>> listAll() {
        List<PartSkuUnit> dtos = service.listAll();
        List<PartSkuUnitDRO> dros = BeanMapper.mapList(dtos, PartSkuUnitDRO.class);
        return ResponseDTO.success(dros, "OK");
    }
}
